defmodule ChoicePlayground.Repo.Migrations.CreateQuestion do
  use Ecto.Migration

  def change do
    create table(:questions) do
      add :seq, :integer
      add :title, :string
      add :type, :string
      add :required, :boolean, default: false, null: false
      add :questionnaire_id, references(:questionnaire, on_delete: :nothing)

      timestamps()
    end
    create index(:questions, [:questionnaire_id])

  end
end
